sqlite - Symfony2 : Unit testing with sqlite
全部标签 我正在使用symfony和doctrine。服务器获取URL/company/{id}的HTTPPATCH请求,其中包含模型的属性及其值,如{"name":"Mynewname"}新值需要持久化到数据库中。$request=Request::createFromGlobals();$requestContentJSON=$request->getContent();$requestContentObj=json_decode($requestContentJSON);$repository=$this->getDoctrine()->getRepository('MyBundle:Co
我遇到了一些奇怪的事情:我通过app/consoledoctrine:generate:entity创建了三个doctrine实体:类别用户发布我建立了关系,并且一切都与fixtures数据一起正常工作(app/consoledoctrine:fixtures:load)。一篇文章属于一个类别(category_id),并且有一个作者(user_id)。我使用app/consoledoctrine:generate:crud为我的所有实体获取CRUD操作。当我更新一个帖子时,我得到了这个奇怪的错误:ContextErrorException:CatchableFatalError:Ob
当我尝试从Controller调用命令时,控制台出现一些问题。我在SymfonyCookBook中找到了一种方法:http://symfony.com/doc/current/cookbook/console/command_in_controller.html好像不行...可能是我忘记了什么!命令:namespaceAppBundle\Command;useSymfony\Component\Console\Command\Command;useSymfony\Component\Console\Input\InputArgument;useSymfony\Component\Con
我有以下模型:classModelextendsBaseModel{publicfunctionsave($conn=null){if(!$this->getId()){//dostuff}returnparent::save($conn);}}我觉得我正在关注Doctrine_Record::save()的API描述签名(除了奇怪的括号,我会给我一个语法错误...)。当我运行这段代码时,运行良好但我收到以下警告:StrictStandards:DeclarationofModel::save()shouldbecompatiblewiththatofDoctrine_Record::
我在表单中使用Select元素'country'=>newsfWidgetFormChoice(array('choices'=>CountryPeer::getAllCountry())),'city'=>newsfWidgetFormChoice(array('choices'=>CityPeer::getAllCity())),我希望在第一次加载页面时禁用该城市元素。并在选择国家/地区时启用城市元素。(它将通过AJAX调用加载) 最佳答案 你可以这样禁用$this->widgetSchema['country']->setAt
我有一个奇怪的问题,当我检查我的app/log/dev.log时,我可以看到我的dev.log中的几乎所有查询都已登录实时:[2015-01-2706:57:22]doctrine.DEBUG:SELECTt0.usernameA....[2015-01-2706:57:23]doctrine.DEBUG:SELECTt0.usernameA...[2015-01-2706:57:23]doctrine.DEBUG:SELECTs0_.id......我不知道为什么会这样,因为当我在config.yml中检查monolog时,我也在生产模式下运行网站,这是我看到的:monolog:ha
我正在尝试在共享服务器上设置一个基于symfony2.7的应用程序,并且没有权限更改php.ini.执行:phpapp/consoledoctrine:schema:drop--force输出此警告/错误:PHPWarning:Uncaughtexception'Symfony\Component\Debug\Exception\ContextErrorException'withmessage'Warning:date_default_timezone_get():Itisnotsafetorelyonthesystem'stimezonesettings.Youare*requir
我有一个第三方包OriginalBundle,我想自定义其中的一些模板。为此,我使用theoverridemethodshownintheSymfonydocs设置了一个Symfony包MyCustomBundle.然后我使用MyCustomBundle从OriginalBundle创建一些Twig模板的覆盖版本。但是,我希望能够从我的版本访问原始模板(例如扩展它)并覆盖一些block。但是,如果我尝试做这样的事情:{#MyCustomBundle:Foo:bar.html.twig#}{%extends'OriginalBundle:Foo:bar.html.twig'%}{%blo
我想通过使用FOSUserBundle登录来确保整个站点的安全。我试过这样设置security.ymlsecurity:encoders:Symfony\Component\Security\Core\User\User:plaintextFOS\UserBundle\Model\UserInterface:sha512role_hierarchy:ROLE_ADMIN:ROLE_USERROLE_SUPER_ADMIN:[ROLE_USER,ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH]providers:fos_userbundle:id:fos_user.u
我尝试从集合中删除实体,但它不起作用。我想我在某处有错误,但我不知道在哪里。这是我的updateAction中的代码:$em=$this->getDoctrine()->getEntityManager();$entity=newPerson();if(!$entity){throw$this->createNotFoundException('UnabletofindPersonentity.');}$editForm=$this->createForm(newPersonType(),$entity);$deleteForm=$this->createDeleteForm($id)